package com.bjsxt.aop;

/**
 * Created by germmy on 17/5/27.
 */

        import org.aspectj.lang.annotation.After;
        import org.aspectj.lang.annotation.AfterReturning;
        import org.aspectj.lang.annotation.AfterThrowing;
        import org.aspectj.lang.annotation.Aspect;
        import org.aspectj.lang.annotation.Before;
        import org.aspectj.lang.annotation.Pointcut;
        import org.springframework.stereotype.Component;

@Aspect
@Component
public class LogInterceptor {
    @Pointcut("execution(public * com.bjsxt.service..*.add(..))")
    public void myMethod(){};

    /*@Before("execution(public void com.bjsxt.dao.impl.UserDAOImpl.save(com.bjsxt.model.User))")*/
    @Before("myMethod()")
    public void before() {
        System.out.println("method staet");
    }
    @After("myMethod()")
    public void after() {
        System.out.println("method after");
    }
    @AfterReturning("execution(public * com.bjsxt.dao..*.*(..))")
    public void AfterReturning() {
        System.out.println("dao方法执行完了吧,嘿嘿");
    }
    @AfterThrowing("execution(public * com.bjsxt.dao..*.*(..))")
    public void AfterThrowing() {
        System.out.println("method AfterThrowing");
    }
}
